<template class="page-grade-detail">
  <van-row>
    <van-nav-bar
      left-text="返回"
      title="考评详情"
      @click-left="$emit('onCancel')"/>
    <panel-grade-base-info :grade="grade"/>
     <!-- <panel-grade-score v-if="(gradeDetail && (grade.problem_status === $vo.GradeStatus.GRADE || grade.problem_status === $vo.GradeStatus.SAVE) && operateType === $vo.OperateType.GRADE)" :grade="gradeDetail.problem_inst" :assessType="assessType" @onConfirm="$emit('onConfirm')"/> -->
    <panel-grade-score-info :grade="grade"/>
    <!--<template v-if="operateType !== $vo.OperateType.GRADE">
      <panel-grade-approve v-if="operateType === $vo.OperateType.CHECK && grade.problem_status === $vo.GradeStatus.CHECK" :grade="grade" @onConfirm="$emit('onConfirm')"/>
      <panel-grade-feedback v-if="(grade.problem_status === $vo.GradeStatus.FEEDBACK || grade.problem_status === $vo.GradeStatus.MODIFY) && (this.operateType === $vo.OperateType.FEEDBACK || this.operateType === $vo.OperateType.MODIFY)" :grade="grade" :assessType="assessType" @onConfirm="$emit('onConfirm')"/>
      <panel-feed-approve v-if="operateType === $vo.OperateType.APPROVE && grade.problem_status === $vo.GradeStatus.APPROVE" :detail="gradeDetail" :assessType="assessType" @onConfirm="$emit('onConfirm')"/>
      <panel-grade-review v-if="operateType === $vo.OperateType.RECHECK && grade.problem_status === $vo.GradeStatus.RECHECK" :detail="gradeDetail" @onConfirm="$emit('onConfirm')"/>
      <panel-grade-final-review v-if="operateType === $vo.OperateType.REVIEW && grade.problem_status === $vo.GradeStatus.REVIEW" :detail="gradeDetail" @onConfirm="$emit('onConfirm')"/>
    </template> -->
    <panel-history-process :historys="gradeDetail ? gradeDetail.history : []"/>
  </van-row>
</template>


<script>
import PanelGradeBaseInfo from '@/views/common/panel/PanelGradeBaseInfo'
//  import PanelGradeScore from '@/views/common/panel/PanelGradeScore'
 import PanelGradeScoreInfo from '@/views/common/panel/PanelGradeScoreInfo'
// import PanelGradeApprove from '@/views/common/panel/PanelGradeApprove'
// import PanelGradeFeedback from '@/views/common/panel/PanelGradeFeedback'
// import PanelFeedApprove from '@/views/common/panel/PanelFeedApprove'
// import PanelGradeReview from '@/views/common/panel/PanelGradeReview'
// import PanelGradeFinalReview from '@/views/common/panel/PanelGradeFinalReview'
import PanelHistoryProcess from '@/views/common/panel/PanelHistoryProcess'
import { getGradeDetail } from '@/api/assess'
export default {
  name: 'PageGradeDetail',
  // components: { PanelGradeBaseInfo, PanelGradeScore, PanelGradeScoreInfo, PanelGradeApprove, PanelGradeFeedback, PanelFeedApprove, PanelGradeReview, PanelGradeFinalReview, PanelHistoryProcess },
  components: { PanelGradeBaseInfo,PanelGradeScoreInfo, PanelHistoryProcess },
  // props: ['grade', 'assessType', 'operateType'],
  props: ['grade'],
  data () {
    return {
      isLoading: false,
      gradeDetail: null
    }
  },
  mounted () {
    this.doQuery()
  },
  methods: {
    doQuery () {
      this.isLoading = true
      console.log('11111111111111111111111111111111')
      getGradeDetail(this.grade.id, this.grade.problem_type).then(res => {
        this.isLoading = false
        let { data } = res
        console.log(data)
        if (data[this.$response.CODE] === this.$response.SUCCESS) {
          this.gradeDetail = data[this.$response.DATA]
        } else {
          this.$toast.fail('获取数据失败：' + data[this.$response.MESSAGE])
        }
      }, errFunc => {
        this.isLoading = false
        this.$notify('服务调用失败：' + errFunc.toString())
        console.log(errFunc.toString())
      })
    }
  }
}
</script>

<style scoped lang="less">
  .page-grade-detail{}
</style>
